package com.show.business.integrate.controller;
import com.show.business.common.core.controller.BaseController;
import com.show.business.integrate.bean.DyvmConfig;
import com.show.business.integrate.service.IDyvmConfigService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 平台管理-语音服务配置表 前端控制器
 * </p>
 *
 * @author dvlp
 * @since 2024-10-25
 */
@RestController
@RequestMapping("/integrate/dyvmConfig")
public class DyvmConfigController extends BaseController {
    @Resource
    private IDyvmConfigService dyvmConfigService;
    /**
     * 获取语言配置列表
     */
    @ApiOperation("获取语言配置列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "pageSize", value = "每页大小", dataType = "Integer", dataTypeClass = Integer.class)
    })
    @GetMapping("/page")
    public Object getPage(DyvmConfig dyvmConfig) {
        startPage();
        List<DyvmConfig> list = dyvmConfigService.getList(dyvmConfig);
        return getDataTable(list);
    }
    /**
     * 添加语言配置
     */
    @ApiOperation("添加语言配置")
    @PostMapping("/save")
    public Object add(@RequestBody DyvmConfig dyvmConfig) {
        return dyvmConfigService.saveInfo(dyvmConfig);
    }
    /**
     * 更新语言配置
     */
    @ApiOperation("更新语言配置")
    @PostMapping("/edit")
    public Object edit(@RequestBody DyvmConfig dyvmConfig) {
        return dyvmConfigService.editInfo(dyvmConfig);
    }

    /**
     * 启用语言配置
     */
    @ApiOperation("启用语言配置")
    @GetMapping("/enable")
    public Object enable(@RequestParam String id) {
        return dyvmConfigService.enable(id);
    }

    /**
     * 禁用语言配置
     */
    @ApiOperation("禁用语言配置")
    @GetMapping("/disable")
    public Object disable(@RequestParam String id) {
        return dyvmConfigService.disable(id);
    }
    /**
     * 删除语言配置
     */
    @ApiOperation("删除")
    @ApiImplicitParam(name = "id", value = "主键ID", required = true, dataType = "String", dataTypeClass = String.class)
    @DeleteMapping("/del")
    public Object del(@RequestParam String[] id) {
        return dyvmConfigService.delInfos(id);
    }
    /**
     * 语言配置详情
     */
    @ApiOperation("详情")
    @ApiImplicitParam(name = "id", value = "主键ID", required = true, dataType = "String", dataTypeClass = String.class)
    @GetMapping("/info")
    public Object getInfo(@RequestParam String id) {
        return dyvmConfigService.getInfo(id);
    }
}
